<script setup>
import { onMounted, ref, onBeforeMount } from "vue";
// import ModuleTitle from "./moduleTitle.vue";
// import GraduationServices from "./GraduationServices.vue";
// import HealthServices from "./HealthServices.vue";
// import EquityServices from "./EquityServices.vue";
// import EnrollmentServices from "./EnrollmentServices.vue";
// import TrainingServices from "./TrainingServices.vue";
import { useUserStore } from "@/stores/user";
import { useRouter } from "vue-router";
// import { login, cockpit } from "@/api/app";

const router = useRouter();
const useStore = useUserStore();
const Refresh1 = ref(0);
let screen = ref();
// cockpit().then((res) => {
//   console.log(res, "yw2222222");
//   if (res.code == 200) {
//     let accessToken = res.data.tokenValue;
//     sessionStorage.setItem("accessToken", accessToken);
//     useStore.authentication = 2;
//     // useStore.Refresh = 1;
//     if (!sessionStorage.getItem("authentication")) {
//       // location.reload();

//       sessionStorage.setItem("authentication", 1);
//     }
//   }
//   // router.push("../index");
// });
// console.log(useStore.authentication, "yyyyyyy");
// if (urlArr.length > 1) {
//   console.log('555555555555');

//   let code = urlArr[1].split("#")[0].split("&")[0].split("=")[1];
//   console.log(code);
//   if (useStore.authentication == 2) {
//     console.log("欢迎1");
//   } else if (code == "y123456789") {
//     console.log("欢迎2");
//     cockpit().then((res) => {
//       console.log(res,'yw111111111111');
//       if (res.code == 200) {
//         let accessToken = res.data.tokenValue;
//         sessionStorage.setItem("accessToken", accessToken);
//         // useStore.Refresh = 1;
//         Refresh1.value = 1;
//         if (!sessionStorage.getItem("authentication")) {
//           // location.reload();
//           sessionStorage.setItem("authentication", 1);
//         }
//       }
//     });
//   } else {
//     console.log("跳转到无权限");
//     //router.push("../prompt");
//   }
// } else {
//   console.log("跳转到无权限");
//   //router.push("../prompt");
// }

onMounted(() => {
  screen.value.style.transform = `scale(${getScale()}) translate(-50%,-50%)`;
});
const getScale = (width = 1920, height = 1080) => {
  let ww = window.innerWidth / width;
  let wh = window.innerHeight / height;
  return ww < wh ? ww : wh;
};
// 监听容器大小
window.onresize = () => {
  screen.value.style.transform = `scale(${getScale()}) translate(-50%,-50%)`;
};
</script>

<template>
  <div class="container">
    <div class="screen" ref="screen">
      <!-- <ModuleTitle /> -->
      <div class="main">
        <div class="ct_c">
          <!-- <EnrollmentServices :Refresh1="Refresh1" /> -->
        </div>
        <div class="ct_c">
          <!-- <TrainingServices :Refresh1="Refresh1" /> -->
        </div>
        <div class="ct_c">
          <!-- <HealthServices :Refresh1="Refresh1" /> -->
        </div>
        <div class="ct_c">
          <!-- <EquityServices :Refresh1="Refresh1" /> -->
        </div>
        <div class="ct_c">
          <!-- <GraduationServices :Refresh1="Refresh1" /> -->
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
.container {
  width: 100vw;
  height: 100vh;
}

.screen {
  position: fixed;
  width: 1920px;
  height: 1080px;
  left: 50%;
  top: 50%;
  transform-origin: left top;
}
</style>
